<template>
	<el-popover
		v-model="showBindEmpPopover"
		width="360"
		trigger="hover"
		icon="el-icon-info"
		title="提示"
	>
		<div>
			<div>1、人员: 从"员工管理"导入属于"{{ checkData.scheduleGroupName || "同班组" }}"的人员;</div>
			<div>2、机台: 取最近一次"{{ checkData.scheduleGroupName || '同班组' }}"对应人员的机台信息.</div>
		</div>
		<div class="flex-end-center margin-top-10">
			<el-button size="small" @click="showBindEmpPopover = false">取消</el-button>
			<el-button :loading="confirmBtnLoading" size="small" type="primary" @click="onConfirmBtn">确定</el-button>
		</div>
		<el-button slot="reference" size="small" type="default" icon="el-icon-c-scale-to-original">智能人机绑定</el-button>
	</el-popover>
</template>
<script>
    import { workforceManagementScheduleCopyScheduleEmpMachine } from '../../../../api/schedule/scheduling';

    export default {
        props: {
            checkData: {
                type: Object,
                default() {
                    return {};
                }
            }
        },
        data() {
            return {
                confirmBtnLoading: false,
                showBindEmpPopover: false
            };
        },
        methods: {
            onConfirmBtn() {
                this.confirmBtnLoading = true;
                workforceManagementScheduleCopyScheduleEmpMachine({
                    'scheduleGroupId': this.checkData.scheduleGroupId,
                    'scheduleId': this.checkData.scheduleId,
                    'scheduleShiftId': this.checkData.shiftItem.id
                }).then(res => {
                    this.confirmBtnLoading = false;
                    this.showBindEmpPopover = false;
                    if (res.data.status === 200) {
                        this.$emit('on-confirm');
                    }
                });
            }
        }
    };
</script>
